public class Test2 {
    public static void main(String[] args) throws InterruptedException {
        Thread t=new Thread(()->{
           for(int i=0;i<5;i++){
               System.out.println("我是一个线程，我正在工作");
               try {
                   Thread.sleep(1000);
               } catch (InterruptedException e) {
                   throw new RuntimeException(e);
               }
           }
        });
        System.out.println(t.getState());
        t.start();
        t.join();
        System.out.println(t.getState());


    }
}
